package com.demo.svc;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.demo.dao.DaoCargo;

@Service("mycargoSvc")
@Lazy
public class SCargoSvc {
	
	@Resource(name="mydao")
	private DaoCargo dc;
	
	@Value("1000")
	private Integer value;
	
	public void cargo() throws Exception{
		
		System.out.println("11111111111");
		dc.getCargo();
		//System.out.println("22222222222");
	}
	
	
	public void insertInv() throws Exception{
		dc.insertInv();
		//throw new RuntimeException();
	}
	
	public void insertLog() throws Exception{
		dc.insertLog();
		//throw new RuntimeException();
	}
	
	
	public void call()throws Exception{
		this.insertInv();
		this.insertLog();
	}
	
	@PostConstruct
	public void init(){
		System.out.println("----init()----");
		System.out.println(value*2);
	}
	
	@PreDestroy
	public void dostory(){
		System.out.println("-------dostory()-------");
	}
	
}
